package com.zhouchb.test;

import java.util.*;

/**
 * @Author Zhouchb
 * @Create 2022-03-2022/3/29 :16:42
 * @Description
 */
public class 两个栈一个队列 {
    public static void main(String[] args) {
        CQueue cq = new CQueue();
        cq.appendTail(2);
        cq.appendTail(3);
        cq.appendTail(24);
        System.out.println(cq.deleteHead());

    }
}
class CQueue {
    Stack<Integer> s1;
    Stack<Integer> s2;
    int size;
    public CQueue() {
        s1 = new Stack<>();
        s2 = new Stack<>();
        size = 0;
    }

    public void appendTail(int value) {
        s1.push(value);
        size++;
    }

    public int deleteHead() {
        if (size==0){
            return -1;
        }

        if (s2.isEmpty()){
            while (!s1.isEmpty()){
                s2.push(s1.pop());
            }
        }
        System.out.println(s2);
        System.out.println(s1);
      /*  size--;
        return s2.pop();*/
        return 0;
    }
}

class heha{
    public static void main(String[] args) {
        String str ="q9w1iq5wu4fu8ih";
        StringBuffer sb = new StringBuffer();
        char[] c = str.toCharArray();
        for (int i=0;i<c.length;i++){
            if (c[i]>='0'&&c[i]<='9'){
                sb.append(c[i]);
            }
        }
        char[] chars = sb.toString().toCharArray();
        Arrays.sort(chars);
        System.out.println(chars);
    }
}

class MyTest {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> result = new ArrayList<Integer>();
        int carry = 0;
        int digit = 1;
        int temp = 1;
        int i,j;
        result.add(1);
        for(i = 2;i<=n;i++){
            for(j = 0,carry = 0;j<digit;j++){
                temp = result.get(j)*i+carry;
                result.set(j, temp%10000);
                carry  = temp/10000;
            }

            while(carry != 0){
                result.add(digit++, carry%10000);
                carry/=10000;
            }
        }
        int count = 1;
        System.out.print(result.get(digit-1));
        for(i = digit-1;i>=1;i--){
            count++;
            if(result.get(i-1)<10){
                System.out.print("000");
            }else if(result.get(i-1)<100){
                System.out.print("00");
            }else if(result.get(i-1)<1000){
                System.out.print("0");
            }
            System.out.print(result.get(i-1));

        }
    }
}